home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
inpt15.zip
/
INPUT.DOC
< prev
next >
Wrap
Text File
|
1991-10-30
|
12KB
|
306 lines
INPUT.EXE 1.5
Copyright 1991 by Chuck Steenburgh
If you use batch files very often, you've probably acquired
a program called ASK.COM or QUERY.COM or something similar
that allows you to ask questions and receive simple respones.
Usually, this involves typing an ECHO command with your
question, followed by ASK.COM or whatever. If you do this
alot, you will probably appreciate the fact the INPUT.EXE
will accomplish the jobs of both the ECHO and ASK commands.
Add to this the greater flexibility that INPUT.EXE offers
in presenting your prompt to the user and in receiving input,
and you'll be sold.
Usage: INPUT ["prompt"] [color] [/C] [/I] [/S] [/Y | /N] [/Pd] |
"prompt" Enter the text you would like to
appear to prompt the user for
input. This can be up to 59 char-
acters and must be enclosed in
quotation marks.
color Enter a number representing the
color in which you want your mes-
sage to appear. You must, of
course, have a color monitor and
card. See Appendix 3.
/C Include this switch if you want
your prompt message centered on
the current line. If you include
this switch, you MUST include a
color value.
/I Use this for a case-insensitive error
level return. If this switch is
included on the command line, pressing
a letter a-z (lower case) will return
the same value as if the corresponding
key A-Z (upper case) were pressed.
/S Show keypress. Adding this switch
will cause INPUT to display the
errorlevel value returned. Use this
for quick "debugging" of your use
of INPUT.EXE
/Y Use this for a yes-no only response.
If the "n" key is pressed, errorlevel
of "0" is returned; pressing any other
key returns an errorlevel of 1. The
prompt "(Y/n)" is appended to the nor-
mal prompt specified by the user.
Page 1
/N Use this for a yes-no only response.
If the "y" key is pressed, errorlevel
of "1" is returned; pressing any other
key returns an errorlevel of 0. The
prompt "(y/N)" is appended to the nor-
mal prompt specified by the user.
This switch takes precedence over the
/y switch.
/Pd Pause 10 seconds for user input, then |
default to "d" (where "d" is any char-|
acter. INPUT will wait up 10 seconds |
for user input. If no key is pressed |
within 10 seconds, INPUT will act as |
if the key specified by the key rep- |
resented by the single character "d" |
was pressed. Note that all other |
switches (case insensitivity, yes/no |
answer, etc.) remain active if time |
expires and the default key is used. |
INPUT adds a warning that it will de- |
fault to the specified value after 10 |
seconds, and will display a succession|
of ten dots to indicate elapsed time. |
The command line parameters may be entered in any
order, may be in any case, and may be preceded by
either the "/" or "-" character.
Examples:
INPUT "Select a number from one to 10"
This prints the text "Select on number from one to 10"
on the current line and waits for a keypress.
INPUT "Press any key to continue" 79
This prints the text "Press any key to continue" on the
current line in bright white on a red background and waits
for a keypress.
INPUT "Press the space bar to exit" 143 /c
This prints the text "Press the space bar to exit" cen-
tered on the current line in flashing bright white on a black
background.
INPUT /s /i "Press any key..." /c 14
Prompts user with "Press any key..." in yellow on black.
Returns a case-insensitive errorlevel and displays it on the
screen before terminating.
Page 2
INPUT "Do you wish to continue?" /s 79 /y
Prompts user with "Do you wish to continue? (Y/n)" in
white on red. Returns errorlevel of 1 unless the "n" key is
pressed. Displays errorlevel on screen.
INPUT "Press any key..." /pf |
Prompts user with "Press any key... (defaults to f after |
10 seconds)" in black on white. Returns errorlevel of 102 if |
no key is pressed within 10 seconds, otherwise returns value of |
key pressed.
INPUT "Press any key..." /c /pf |
Prompts user with "Press any key... (defaults to f after |
10 seconds)" in black on white. Returns errorlevel of 70 if no |
key is pressed within 10 seconds, otherwise returns the upper |
case ASCII value of the key pressed. |
INPUT will also sound an alarm to let the user know that
a response is expected.
When a key is pressed, INPUT will set the errorlevel equal
to the ASCII value of the key pressed. This is slightly dif-
ferent from BATBOX in that in normal operation INPUT is case
sensitive and will allow you to distinguish between upper and
lower case letters. If you want a case-insensitive return, use
the /i switch. See Appendix 2 for a complete list of the ASCII
characters theoretically supported by INPUT.
If you want greater control over the placement of your prompt
message on the screen, use WRITE in conjunction with INPUT.
Use WRITE to display your prompt then use INPUT without the
"prompt," color, or /c parameters.
INPUT is part of STEENBURGH'S STUFF Mildly Useful Utilities.
STEENBURGH'S STUFF includes the following programs:
BATBOX: Simple menu creation/inpu